local shanzhuan = fk.CreateSkill {
    name = "jinld__shanzhuan",
}

Fk:loadTranslationTable {
    ["jinld__shanzhuan"] = "擅专",
    [":jinld__shanzhuan"] = "出牌阶段开始时，你可以展示所有手牌，然后对一名其他角色发起一次“军令”，若其执行，你交给其一张展示的手牌，否则你对其造成1点伤害。",

    ["#jinld__shanzhuan-choose"] = "擅专：你可以展示所有手牌并选择一名其他角色，对其发起一次“军令”",
    ["#jinld__shanzhuan_give"] = "擅专：选择一张牌，交给 %src",

    ["$jinld__shanzhuan1"] = "尔等罪证，可俱在本宫手中。",
    ["$jinld__shanzhuan2"] = "哼!再有犯者，皆有如此人。",
}

local H = require "packages/ol_hegemony/util"

shanzhuan:addEffect(fk.EventPhaseStart, {
    anim_type = "offensive",
    can_trigger = function(self, event, target, player, data)
        return player:hasSkill(shanzhuan.name) and target == player and player.phase == Player.Play and
        not player:isKongcheng()
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        room:showCards(player:getCardIds("h"), player)
        room:delay(350)
        local to = room:askToChoosePlayers(player, {
            targets = room:getOtherPlayers(player),
            min_num = 1,
            max_num = 1,
            prompt = "#jinld__shanzhuan-choose",
            skill_name = shanzhuan.name,
            cancelable = false,
        })
        if #to > 0 then
            if H.askCommandTo(player, to[1], shanzhuan.name) then
                local card = room:askToCards(player, {
                    min_num = 1,
                    max_num = 1,
                    pattern = ".|.|.|hand|.|.|.",
                    skill_name = shanzhuan.name,
                    prompt = "#jinld__shanzhuan_give:"..to[1].id,
                    cancelable = false,
                })
                if #card > 0 then
                    room:moveCardTo(card, Card.PlayerHand, to[1], fk.ReasonGive, shanzhuan.name, nil, true, player)
                end
            else
                room:damage {
                    from = player,
                    to = to[1],
                    damage = 1,
                    skillName = shanzhuan.name,
                }
            end
        end
    end,
})

return shanzhuan
